﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.ComponentModel.Composition;

namespace Kooboo.Commerce.Repositories
{
    [Export(typeof(IPromotionRule))]
    public partial class PromotionRule:Entity,IPromotionRule
    {
        #region IPromotionRule Members

        List<IPromotionRule> _KillRules;
        public List<IPromotionRule> KillRules
        {
            get
            {
                if(this._KillRules == null)
                {
                    this._KillRules = this.DataContext.PromotionExclusiveRules
                        .Where(i => i.PromotionRuleId1 == this.Id)
                        .Select(i=>i.PromotionRule1 as IPromotionRule)
                        .ToList();
                }

                return this._KillRules;
            }
            set
            {
                this._KillRules = value;
            }
        }

        #endregion
    }
}
